From: Rob Church Date: Sat, 25 Mar 2006 02:48:31 +0000 (+0000) Subject: Improve detection of blank edit summaries where automatic summaries (from section... X-Git-Tag: 1.6.0~135 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=5024cd36d65b82d884524d2bc5f3b86af32c8989;p=lhc%2Fweb%2Fwiklou.git Improve detection of blank edit summaries where automatic summaries (from section editing) are concerned --- diff --git a/includes/EditPage.php b/includes/EditPage.php index 18e99cd29f..670757b2bb 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -29,6 +29,7 @@ class EditPage { var $missingComment = false; var $missingSummary = false; var $allowBlankSummary = false; + var $autoSumm = ''; # Form values var $save = false, $preview = false, $diff = false; @@ -384,7 +385,7 @@ class EditPage { $this->minoredit = $request->getCheck( 'wpMinoredit' ); $this->watchthis = $request->getCheck( 'wpWatchthis' ); $this->allowBlankSummary = $request->getBool( 'wpIgnoreBlankSummary' ); - + $this->autoSumm = $request->getText( 'wpAutoSummary' ); } else { # Not a posted form? Start with nothing. wfDebug( "$fname: Not a posted form.\n" ); @@ -632,11 +633,13 @@ class EditPage { } # Handle the user preference to force summaries here - if( trim( $this->summary ) == '' && !$this->allowBlankSummary && $wgUser->getOption( 'forceeditsummary' ) ) { - $this->missingSummary = true; - wfProfileOut( $fname ); - return( true ); - } + if( !$this->allowBlankSummary && $wgUser->getOption( 'forceeditsummary' ) ) { + if( md5( $this->summary ) == $this->autoSumm ) { + $this->missingSummary = true; + wfProfileOut( $fname ); + return( true ); + } + } # All's well wfProfileIn( "$fname-sectionanchor" ); @@ -1070,12 +1073,18 @@ END $wgOut->addHTML( "\n\n" ); } - # If there's no summary, slip in a hidden tag here - # If the user doesn't want to provide one, hitting Save a second time will cause it to go - # through without further hassle + # If a blank edit summary was previously provided, and the appropriate + # user preference is active, pass a hidden tag here. This will stop the + # user being bounced back more than once in the event that a summary + # is not required. if( $this->missingSummary ) { $wgOut->addHTML( "\n" ); } + + # For a bit more sophisticated detection of blank summaries, hash the + # automatic one and pass that in a hidden field. + $autosumm = md5( $this->summary ); + $wgOut->addHTML( "\n" ); if ( $this->isConflict ) { require_once( "DifferenceEngine.php" );